package com.kingcore.commerce.front.controller;

//import javax.inject.Inject;
import java.io.Serializable;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kingcore.commerce.admin.bean.BookBean;
import com.kingcore.commerce.admin.bean.Chapter;
import com.kingcore.commerce.admin.bean.ChapterConditionVO;
import com.kingcore.commerce.base.controller.CommerceController;

@Controller
@RequestMapping("/front")
public class IndexController extends CommerceController{

	// @Inject
	// private User user; 
	
	@RequestMapping("")
	public String index() {
		return "redirect:/front/chapters";
	}

	@RequestMapping("/books")
	public String books(Model model) {
		System.out.println(getMessage("ui.title"));
//		List<BookBean> bookList = bookMgr.searchBook(null, null, 0, 100);
//		model.addAttribute(bookList);
		return "/front/books";
	}
	
	@RequestMapping("/chapters")
	public String chapters(ChapterConditionVO vo, Model model) {
//		List<Chapter> chapters = bookMgr.searchChapters(vo);
	
//		model.addAttribute("chapters", chapters);
		
		return "/front/chapters";
	}
	
	@RequestMapping("/chapter/{chapterId}")
	public String chapter(@PathVariable("chapterId") int chapterId, Model model) {

//		Chapter chapter = bookMgr.getChapter(chapterId);
//		BookBean book = bookMgr.getBook( new Long(chapter.getBookId()) );
//		model.addAttribute(chapter);
//		model.addAttribute(book);

		return "/front/chapter";
	}

	@Override
	protected String getModuleParent() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getModuleName() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String neww(HttpServletResponse response, Model model)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String edit(HttpServletResponse response, Model model,
			Serializable pk) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String list(HttpServletResponse response, Model model, Object t,
			Integer pageNum, Integer numPerPage) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView add(HttpServletResponse response, Model model, Object t)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView mod(HttpServletResponse response, Model model, Object t)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView remove(HttpServletResponse response, Model model,
			Serializable pk) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}
}